<?php
$this->breadcrumbs=array(
	'Logs'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Logs', 'url'=>array('index')),
	array('label'=>'Create Logs', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('logs-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>


<?php
$user_r = array();
$users = User::model()->findAll();
foreach($users as $user){
    $user_r[$user->id]=$user->username;
}

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'logs-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
        array(
            'name' =>'id',
            'value'=>'$data->id',
            'htmlOptions'=>array('width'=>'40','style'=>'text-align:center;'),
        ),
        array(
            'name' =>'uid',
            'value'=>'get_username($data->uid)',
            'filter'=>(Yii::app()->user->id == 1) ? $user_r : false,
            'htmlOptions'=>array('width'=>'125'),
        ),
		'code',
		'content',
        array('name'=>'time','value'=>'date("Y-m-d H:i:s", $data->time);'),
        array( 'class'=>'CLinkColumn',
            'header'=>'查看',//显示表名称
            'labelExpression'=>'"<img src=\"/easyui/images/search.png\" />"',//显示名称
            'urlExpression'=>'Yii::app()->createUrl("logs/view",array("id"=>$data->id))',//显示URL
            'linkHtmlOptions'=>array('style'=>'text-align:center;display:block;')
        ),
	),
)); ?>
